import java.util.Random;
import java.util.Scanner;

/*
public class T20250317 {
    public static int add(int a, int b) {
        return a + b;
    }

    public static double add(double a, double b) {
        return a + b;
    }

    public static double add(double a, double b, double c) {
        return (a > b ? a : b) > c ? (a > b ? a : b) : c;
    }

    public static boolean add(boolean a, boolean b) {
        return a&b;
    }

    public static void main(String[] args) {
//        System.out.println(add(1,2));
//        System.out.println(add(3,4));
//        System.out.println(add(1,2));
//        System.out.println("**********************");
//        System.out.println(add(2.3,2.4));
//        System.out.println(add(1.0,2.3,1.7));
//        System.out.println(add(10>3,10>7));
//        sc.close();
//        Scanner sc = new Scanner(System.in);
//        int sum = 0;
//        int count = 0;
//        while(sc.hasNextInt()) {
//            int num = sc.nextInt();
//            sum+=num;
//            count++;
//        }
//        System.out.println("sum: " + sum);
//        System.out.println("avg: " + sum/count);
//       Scanner cs = new Scanner(System.in);
//        System.out.print("请输入你的姓名: ");
//        String name = cs.nextLine();
//        //next()->遇到空格结束
//        System.out.println("姓名: " + name);
//        System.out.print("请输入你的年龄: ");
//       int age = cs.nextInt();
//        System.out.println("年龄: " + age);
//        System.out.print("请输入工资: ");
//        float salary = cs.nextFloat();
//        System.out.println("工资: " + salary);
//        cs.close();
    }
}
//    public static void main(String[] args) {
//        for(int n = 100, count = 0; n < 100000; n++) {
//            int sum = 0,c = n, c_Num = count_Num(n);
//            while(c!=0) {
//                sum+=Math.pow(c%10,c_Num);
//                c/=10;
//            }
//            if(sum == n){
//                count++;
//                System.out.print(n+"\t");
//                if(count%5==0){
//                    System.out.println();
//                }
//            }
//        }
//    }
//    public static int count_Num(int n) {
//        int count = 0;
//        while (n != 0) {
//            n/=10;
//            count++;
//        }
//        return count;
//    }
//}
//        while(true)
//            System.out.println(10);
//    }
   */
/* public static void main(String[] args) {
      *//*
*/
/*  int a = 1;
        double b = 3;
        boolean c = false;
        char e = '遁';
        String d = "辟邪神雷";
        byte f = 100;
        long g = 12345L;
        float h = 3.13f;
//        System.out.println("a = "+a);
//        System.out.println("b = "+b);
//        System.out.println("c = "+c);
//        System.out.println("e = "+e);
//        System.out.print("n: "+d+'\n');
//        System.out.printf("f: %d\n",100);
//        System.out.println("--------------------");
//        System.out.println("g = "+g+", h = "+h);
//        System.out.println(Integer.MAX_VALUE);
//        System.out.println(Integer.MIN_VALUE);
//        System.out.println(Short.MAX_VALUE);
//        System.out.println(Short.MIN_VALUE);*//*
*/
/*
        boolean a = !(10<3);
        int b = 100;
        long c = 200;
        short d = 300;
        float e = 3.0F;
        double f = 233;
        c = b;
        b = (int)c;
        b = d;
        b += c;
        b = (int)(b + c);
        e-=f;
        e=(float)(e-f);
        b = (int)f;
        e = b;
        System.out.printf("%d %f %f\n",3/2,3*1.0/2,3/(2*1.0));
        System.out.println("first: "+3%2+3.5%3);
        System.out.print("a: "+a+'\n');
        System.out.println(Character.MAX_VALUE);
        System.out.println(Character.MIN_VALUE);
        System.out.println("abc"+" cd"+(100+23));
        System.out.printf("%s %d",String.valueOf(123),Integer.parseInt("1234"));
        System.out.println("____________________");
        System.out.println(10<3&5%1==0);
        System.out.println(10>3||5%0==0);
        a = true == true?a?false:true:false;
        System.out.println(a);
        System.out.println(~-3+' '+3^0);
        int result3 = 3 << 2; // 左移
        int result4 = 9 >> 2; // 右移
        int result5 = 8 >> 2; // 右移
        int result6 = -1 >>> 1; // 无符号右移
        System.out.println(result3 + " " + result4 + " " + result5 + " " + result6);
    }*//*
*/

public class T20250317 {

    public static boolean if_ss(int n) {
        int i;
        double ns;
        for (i = 2, ns = Math.sqrt(n); i <= ns; i++) {
                if(n%i == 0) {
                    break;
                }
        }
        return i > ns;
    }

    public static void count_ss() {
        Scanner sc = new Scanner(System.in);
        int count = 0;
        System.out.print("请输入起始值: ");
        int start = sc.nextInt();
        System.out.print("请输入结束值: ");
        int end = sc.nextInt();
        for(int startc = start;startc<=end;startc++) {
            if(if_ss(startc)) {
                count++;
            }
        }
        System.out.println(start + "~" + end + "间的素数个数为: " + count);
    }

    public static int fact(int n) {
        if (n == 1 || n == 0) {
            return 1;
        }
        int product = 1;
        for(int i = 2; i <= n; i++) {
            product*=i;
        }
        return product;
    }

    public static void  sum_Fact() {
        Scanner sc = new Scanner(System.in);
        System.out.print("请选择范围(a b)-> ");
        int start = sc.nextInt();
        int end = sc.nextInt();
        int sum = 0;
        for(int s = start; s <= end; s++) {
            sum+=fact(s);
        }
        System.out.println(start + "~" + end + "范围内的阶乘总和为: " + sum);
    }

    public static int fact_Num(int n) {
        if(n == 0 || n == 1) {
            return 1;
        }
        return n * fact_Num(n - 1);
    }

    public static void Fact() {
        Scanner sc = new Scanner(System.in);
        while(true){
            System.out.print("请输入: ");
            int n = sc.nextInt();
            System.out.println("!" + n + "的值为: " + fact_Num(n));
        }
    }

    public static void asc_Print(int n) {
        if(n > 9) {
            asc_Print(n/10);
        }
        System.out.print(n % 10 + " ");
        return ;
    }

    public static void print_Num() {
        Scanner sc = new Scanner(System.in);
        while (true) {
            System.out.print("请输入: ");
            int n = sc.nextInt();
            asc_Print(n);
            System.out.println();
        }
    }

    public static void fib() {
        while(true) {
            Scanner sc = new Scanner(System.in);
            System.out.print("请输入: ");
            int n = sc.nextInt();
           if(n > 0 && n < 3) {
               System.out.println("fib(" + n + "): " + 1);
           }
           else if(n == 0) {
               System.out.println("fib(" + n + "): " + 0);
           }
           else if(n > 2) {
               int n1 = 1, n2 = 1, n3 = 0;
               for(int i = 3; i <= n; i++) {
                   n3 = n1 + n2;
                   n1 = n2;
                   n2 = n3;
               }
               System.out.println("fib(" + n + "): " + n3);
           }
           else {
               System.out.println("无效输入");
           }
        }
    }

    public static void guess_Num() {
        Random random = new Random();
        Scanner sc = new Scanner(System.in);
        while (true) {
            int start, end;
            System.out.println("请输入随机数值生成范围");
            System.out.print("开始: ");
            start = sc.nextInt();
            System.out.print("结束: ");
            end = sc.nextInt();
            int toGuess = random.nextInt(end + 1) + start ;//[1,100]
            while(true) {
                int guess = sc.nextInt();
                if(guess > toGuess) {
                    System.out.println("猜大了");
                }
                else if(guess == toGuess) {
                    System.out.println("猜对了!!!");
                    break;
                }
                else {
                    System.out.println("猜小了");
                }
            }
        }
    }

    public static void main(String[] args) {
//        count_ss();
//        sum_Fact();
//        Fact();
//        print_Num();
//        fib();
        guess_Num();
    }
}







































